package com.yocky.eventutilsdemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;


public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener {

    private final static String TAG = "[BaseActivity.class]";
    protected Activity activity;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        activity = this;
        super.onCreate(savedInstanceState);
//        setStateBarColor(R.color.white);
//        MyActivityManager.getInstance().addLauncherRecord(this);
        View view= LayoutInflater.from(this).inflate(getlayoutView(),null);
        setContentView(view);
        initView(view);
        initData();
    }

//    protected void setStateBarColor(int resId) {
//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//            Window win = getWindow();
//            WindowManager.LayoutParams winParams = win.getAttributes();
//            final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
//            winParams.flags |= bits;
//            win.setAttributes(winParams);
//            SystemBarTintManager tintManager = new SystemBarTintManager(this);
//            tintManager.setStatusBarTintEnabled(true);
//            tintManager.setStatusBarTintResource(resId);
//            tintManager.setStatusBarDarkMode(true, this);
//        }
//    }

    protected abstract int getlayoutView();

    protected abstract void initView(View view);

    protected abstract void initData();

    protected abstract void clickListener(View view);

    @Override
    public void onClick(View view) {
        clickListener(view);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }


}
